//
//  JCProgressCell.m
//  JiFengDaRen
//
//  Created by shouhan on 2018/3/30.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCProgressCell.h"
#import "ProgressModel.h"

@interface JCProgressCell()

@property (nonatomic, strong) UILabel * titleName;

@property (nonatomic, strong) UILabel * contentLabel;

@end

@implementation JCProgressCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI{
    
    self.titleName = [UILabel new];
    self.titleName.textColor = [UIColor colorWithHexString:@"#474958"];
    self.titleName.font = KSystemFont(__I6Width(13));
    [self addSubview:self.titleName];
    
    self.contentLabel = [UILabel new];
    self.contentLabel.textColor = [UIColor colorWithHexString:@"#474958"];
    self.contentLabel.font = KSystemFont(__I6Width(13));
    self.contentLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.contentLabel];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.titleName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(__I6Width(15));
        make.centerY.equalTo(self);
        make.width.mas_offset(__I6Width(150));
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(-__I6Width(15));
        make.left.equalTo(self.titleName.mas_right).offset(10);
    }];
}

+ (instancetype)tableViewCellWithTableView:(UITableView *)tableView{
    
    static NSString * cellIndentfile = @"JCProgressCell";
    JCProgressCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIndentfile];
    
    if (!cell) {
        cell = [[JCProgressCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentfile];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (void)getTitleNameInfo:(NSMutableArray *)arr Index:(NSInteger)index{
    
    self.titleName.text = arr[index];
}



- (void)setProgressModel:(ProgressModel *)progressModel{
    
    _progressModel = progressModel;

    double ratedouble = [progressModel.rate doubleValue];
    NSString * type;
    if ([progressModel.channel_type isEqualToString:@"1"]) {
        type = @"小额落地商户";
    }else{
        type = @"大额还款";
    }
    NSMutableArray * arr = [NSMutableArray arrayWithObjects:progressModel.repay_status,progressModel.repay_order_id,progressModel.create_time,progressModel.trade_time,progressModel.transfer_time,progressModel.fee,[NSString stringWithFormat:@"%.4f",ratedouble],type,progressModel.trade_amount,progressModel.transfer_amount,progressModel.cardNo,progressModel.bankName,progressModel.bankCode,progressModel.repayPlanId, nil];
    
    self.contentLabel.text = arr[_index];
    
}







- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
